<?php

namespace App\Http\Requests\OrderController;

use Illuminate\Foundation\Http\FormRequest;

class OrderPayGoodRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'good_id' => 'required|integer|gte:1',
            'shop_address_id' => 'required|integer|gte:1',
            'number' => 'required|integer|gte:1',
            'pay_password' => 'required|string'
        ];
    }

    public function messages()
    {
        return [
            'good_id.required' => __('商品ID不能为空'),
            'good_id.integer' => __('商品ID必须是整数类型'),
            'good_id.gte' => __('商品ID必须大于或等于1'),

            'shop_address_id.required' => __('收货地址ID不能为空'),
            'shop_address_id.integer' => __('收货地址ID必须是整数类型'),
            'shop_address_id.gte' => __('收货地址ID必须大于或等于1'),

            'number.required' => __('购买数量不能为空'),
            'number.integer' => __('购买数量必须是整数类型'),
            'number.gte' => __('购买数量必须大于或等于1'),

            'pay_password.required' => __('交易密码不能为空'),
            'pay_password.string' => __('交易密码必须是字符串类型'),
        ]; // TODO: Change the autogenerated stub
    }
}
